package com.gljx.web.service.impl;

import com.gljx.web.dao.CalculatetimecarsubMapper;
import com.gljx.web.dao.CommonDao;
import com.gljx.web.service.CalculatetimecarsubService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2018/1/11 0011.
 */


@Service
@Transactional
public class CalculatetimecarsubServiceImpl extends CommonDao implements CalculatetimecarsubService {

    @Autowired
    CalculatetimecarsubMapper calculatetimecarsubMapper;

    @Override
    public Map<String, Object> selectPage(int pindex, String psql, int psize) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("Pindex", pindex);
        paramMap.put("Psql", psql);
        paramMap.put("Psize", psize);
        paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
        paramMap.put("v_cur", oracle.jdbc.OracleTypes.CURSOR);
        this.getSqlSession().select("com.gljx.web.dao.CalculatetimecarsubMapper.pagemap", paramMap, null);
        return paramMap;
    }

    @Override
    public Map<String, Object> selectPageCount(String psql) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("Psql", psql);
        paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
        this.getSqlSession().select("com.gljx.web.dao.CalculatetimecarsubMapper.pagecount", paramMap, null);
        return paramMap;
    }

    @Override
    public void deleteByCalculatetimecarsubKey(String[] deleteId) {

        for (String fid : deleteId) {
            calculatetimecarsubMapper.deleteByPrimaryKey(fid);
        }
    }
}
